//
//  PurchaseInfoController.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/6/21.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import Foundation
class PurchaseInfoController: BaseController {
    var purchase:PurchaseModel!
    var purchaseCarView: PurchaseCarView = {
        let view = PurchaseCarView.init(frame: CGRect(x: 0, y: kStatusBarH + kNavigationBarH, width: kScreenW, height:kScreenH - kStatusBarH - kNavigationBarH))
        return view
    }()
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        setupNavBar(title: "新车代购", isback: true, appearWay: 3, isright: false)//自定义导航
        purchaseCarView.purchType = "update"
        purchaseCarView.carTypeText = purchase.carType
        purchaseCarView.priceText = purchase.price
        purchaseCarView.nameText = purchase.buyerName
        purchaseCarView.phoneText = purchase.buyerPhone
        purchaseCarView.remarkText = purchase.remark
        purchaseCarView.ostatus = purchase.ostatus
        self.view.addSubview(purchaseCarView)
    }
}
extension PurchaseInfoController{
    //抢单
    func acceptFun() {
        let urlString = "\(projectUrl)/order/other/accept/carpurchase/\(purchase.orderNo)/\(userID!)?tokenID=\(tokenID!)&tokenUserID=\(userID!)"
        toOperatOrder(url: urlString)
    }
    //完成
    func finishFun(){
        let urlString = "\(projectUrl)/order/other/finish/carpurchase/\(purchase.orderNo)/\(userID!)?tokenID=\(tokenID!)&tokenUserID=\(userID!)"
        toOperatOrder(url: urlString)
    }
}
